package com.glela.order.util;

import java.util.Comparator;

import org.apache.commons.lang3.math.NumberUtils;

import com.glela.order.model.OrderDetail;

/**
 * 根据订单商品的店铺ID比较大小
 * @author zls
 *
 */
public class StoreComparator implements Comparator<OrderDetail> {

	@Override
	public int compare(OrderDetail o1, OrderDetail o2) {
		if (o1.getStoreId() == null) {
			o1.setStoreId(0);
		}
		if (o2.getStoreId() == null) {
			o2.setStoreId(0);
		}

		return NumberUtils.compare(o1.getStoreId(), o2.getStoreId());
	}

}
